package com.tvunetworks.center.device.service;

import com.tvunetworks.center.common.model.SearchDeviceParam;
import com.tvunetworks.center.common.model.UserBehavior;
import com.tvunetworks.center.common.util.Result;
import com.tvunetworks.center.device.model.json.PageParam;
import com.tvunetworks.center.device.util.PageBar;
import com.tvunetworks.center.gs.model.Device;
import com.tvunetworks.center.gs.model.DeviceExtend;
import com.tvunetworks.center.gs.model.UserDeviceOperation;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Set;

/**
 * @program: tvucc-aggregator
 * @author lebronchen
 * @create: 2019-11-05 14:45
 **/
public interface UserDeviceService {

    /**
     * 根据UserId获取所属的device
     * @param userId userId
     * @return device的peerId集合
     */
    Set<String> getDeviceIdByUser(String userId);

    /**
     *
     * @param userId userId
     * @param param param
     * @return List
     */
    List<Device> listRPSDevice(String userId, SearchDeviceParam param);

    /**
     *
     * @param pageParam pageParam
     * @return  PageBar
     * @throws Exception 编译异常
     */
    PageBar<DeviceExtend> getReceiverList(PageParam pageParam) throws Exception;

    /**
     *
     * @param pageParam pageParam
     * @param role role
     * @return PageBar
     * @throws Exception 编译异常
     */
    PageBar<Device> getAllDeviceSource (PageParam pageParam,String role) throws Exception;

    /**
     *
     * @param pageParam pageParam
     * @return Result
     * @throws Exception 编译异常
     */
    Result<Object> getAllDeviceSourceByPack (PageParam pageParam) throws Exception;

    /**
     *
     * @param userDeviceOperation userDeviceOperation
     * @throws Exception 编译异常
     */
    void updataUserDeviceOperation(UserDeviceOperation userDeviceOperation) throws Exception;

    /**
     *
     * @param userBehavior userBehavior
     * @param userId userId
     * @return PageBar
     */
    PageBar<DeviceExtend> queryReceiver(UserBehavior userBehavior, String userId);

    /**
     *
     * @param userId userId
     * @return List
     */
     List<String> getBindTRPeerIdList(String userId);

    /**
     *
     * @param peerId peerId
     * @return Device
     */
     Device queryDeviceById(String peerId);

    /**
     *
     * @param pageParam pageParam
     * @return Result
     * @throws Exception 编译异常
     */
    Result<Object> queryUserSourcelist (PageParam pageParam) throws Exception;

    /**
     *
     * @return  Result
     * @throws Exception  编译异常
     */
    Result<Object> queryGeoRecordSelection () throws Exception;

    /**
     *
     * @param pageParam pageParam
     * @param response response
     * @param role role
     * @throws Exception 编译异常
     */
     void extracted(PageParam pageParam, HttpServletResponse response,String role) throws Exception ;

    /**
     *
     * @param pageParam pageParam
     * @param role  role
     * @return Result
     * @throws Exception 编译异常
     */
    Result<Object> getAllDeviceSourceByUserOrRid(PageParam pageParam,String role) throws Exception;

    /**
     * 设备状态变化时,目前把信息封装成partyline需要的,发到mq中
     * @param message message
     * @throws IOException 编译异常
     */
    void  deviceStatusChanged(String message) throws IOException;
}
